home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / E-G / FirstPathComponent.cpt / FirstPathComponent / card_3035.txt < prev    next >
Text File  |  1989-04-13  |  4KB  |  175 lines

  1. -- card: 3035 from stack: in
  2. -- bmap block id: 3117
  3. -- flags: 0000
  4. -- background id: 2774
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0004
  11. -- rect: left=219 top=315 right=335 bottom=389
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: results
  20.  
  21.  
  22. -- part 2 (button)
  23. -- low flags: 00
  24. -- high flags: 2004
  25. -- rect: left=436 top=284 right=337 bottom=504
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 17885 / 17885
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: 
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   go home
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part 4 (button)
  42. -- low flags: 00
  43. -- high flags: A003
  44. -- rect: left=327 top=284 right=306 bottom=427
  45. -- title width / last selected line: 0
  46. -- icon id / first selected line: 0 / 0
  47. -- text alignment: 1
  48. -- font id: 0
  49. -- text size: 12
  50. -- style flags: 0
  51. -- line height: 16
  52. -- part name: Try It
  53. ----- HyperTalk script -----
  54. on mouseUp
  55.   put "" into cd field "results"
  56.   firstPathComponent
  57. end mouseUp
  58.  
  59.  
  60.  
  61. -- part 5 (field)
  62. -- low flags: 01
  63. -- high flags: 0004
  64. -- rect: left=9 top=66 right=279 bottom=507
  65. -- title width / last selected line: 0
  66. -- icon id / first selected line: 0 / 0
  67. -- text alignment: 0
  68. -- font id: 3
  69. -- text size: 10
  70. -- style flags: 0
  71. -- line height: 13
  72. -- part name: 
  73.  
  74.  
  75. -- part 8 (button)
  76. -- low flags: 00
  77. -- high flags: A003
  78. -- rect: left=209 top=284 right=306 bottom=309
  79. -- title width / last selected line: 0
  80. -- icon id / first selected line: 0 / 0
  81. -- text alignment: 1
  82. -- font id: 0
  83. -- text size: 12
  84. -- style flags: 0
  85. -- line height: 16
  86. -- part name: Show script
  87. ----- HyperTalk script -----
  88. on mouseUp
  89.   set visible of cd field "script" to not visible of cd field "script"
  90.   if visible of cd field "script" is true then
  91.     set name of cd button id 8 to "Hide script"
  92.   else
  93.     set name of cd button id 8 to "Show script"
  94.   end if
  95.  
  96.  
  97. end mouseUp
  98.  
  99.  
  100.  
  101. -- part 9 (field)
  102. -- low flags: 81
  103. -- high flags: 0004
  104. -- rect: left=9 top=66 right=278 bottom=506
  105. -- title width / last selected line: 0
  106. -- icon id / first selected line: 0 / 0
  107. -- text alignment: 0
  108. -- font id: 3
  109. -- text size: 9
  110. -- style flags: 0
  111. -- line height: 12
  112. -- part name: script
  113.  
  114.  
  115. -- part 11 (button)
  116. -- low flags: 00
  117. -- high flags: A003
  118. -- rect: left=90 top=284 right=306 bottom=190
  119. -- title width / last selected line: 0
  120. -- icon id / first selected line: 0 / 0
  121. -- text alignment: 1
  122. -- font id: 0
  123. -- text size: 12
  124. -- style flags: 0
  125. -- line height: 16
  126. -- part name: Copy to stack
  127. ----- HyperTalk script -----
  128. on mouseUp
  129.   answer "Select a stack to copy this function to."
  130.   put FileName("STAK") into theStack
  131.   if it is empty then exit mouseUp
  132.   set lockscreen to true
  133.   push this card
  134.   put cd field "script" into theScript
  135.   put script of stack theStack into temp
  136.   put return & return & theScript after temp
  137.   set script of stack theStack to temp
  138. end mouseUp
  139.  
  140.  
  141. -- part contents for card part 5
  142. ----- text -----
  143.      FirstPathComponent extracts the first component of a file's full pathName and places it into a holder.  For instance, if you're using a hard disk, the full path might be:
  144.    "Hard Disk:Stackware:MyStack"
  145.  
  146.      FirstPathComponent will put the first component "Hard Disk" into the holder "results".
  147.  
  148.      NOTE:  This function makes necessary use of the FileName XFCN, which was written by Steve Maller and which is available on most bulletin boards.  You can copy if from this stack if you want.
  149.  
  150. written by Bob Patin
  151.  
  152. This stack is FREEWARE from:
  153.      Missing Byte Software
  154.      112 Hickory Park Lane
  155.      Antioch, TN  37013
  156.      615/331-6925
  157.  
  158. -- part contents for card part 9
  159. ----- text -----
  160. on firstPathComponent
  161.   global results
  162.   set lockscreen to true
  163.   put FileName() into longName
  164.   put the length of longName into theLength
  165.   put "" into shortname
  166.   put 1 into i
  167.   repeat until i > theLength
  168.     if character i of longName is ":" then exit repeat
  169.     put character i of longName after shortName
  170.     put i + 1 into i
  171.   end repeat
  172.   put shortName into results
  173.   set lockscreen to false
  174. end firstPathComponent
  175.